import {platformState} from "~/stores/platform/index.js";

export default defineNuxtRouteMiddleware(async (to, from) => {
    // 如果你刷新不想弹窗登录，
    if (process.client) {
        if (
            to.fullPath.indexOf('/note/base') != -1 ||
            to.fullPath.indexOf('/admin/sbase') != -1 ||
            to.fullPath.indexOf('/admin/base') != -1 ||
            to.fullPath.indexOf('/note/detail') != -1 ||
            to.fullPath.indexOf('/note/page') != -1 ||
            to.fullPath.indexOf('/word') != -1 ||
            to.fullPath.indexOf('/note/add') != -1
        ) {
            platformState().setOpenFlag(true)
        } else {
            platformState().setOpenFlag(false)
        }

        if (
            to.fullPath.indexOf('/special/ddd') != -1 ||
            to.fullPath.indexOf('/classroom') != -1
        ) {
            platformState().setHeaderFlag(true)
        } else {
            platformState().setHeaderFlag(false)
        }
    }
})